package routes

import (
	"game-server/app/controllers/admin"
	"game-server/app/middleware"
	"game-server/app/services"

	"github.com/gin-gonic/gin"
)

func SetSysRoleRoutes(router *gin.RouterGroup) {
	adminRouter := router.Group("/admin")
	{
		// 需要认证的路由
		authRouter := adminRouter.Use(middleware.JWTAuth(services.AdminGuardName))

		// authRouter := adminRouter
		{
			// 系统用户管理
			// 在认证路由组中添加
			//获取全部角色的集合
			authRouter.GET("/role/all", admin.SysRoleAll) //done

			////添加角色
			authRouter.POST("/role/create", admin.SysRoleCreate) //done

			//根据id查询角色信息
			authRouter.GET("/role/detail/:id", admin.SysRoleDetail) //done
			//更新角色信息
			authRouter.POST("/role/update", admin.SysRoleUpdate)

			//根据id删除角色信息
			authRouter.DELETE("/role/delete/:id", admin.SysRoleDelete)
			//批量删除
			authRouter.POST("/role/delete/batch", admin.SysRoleDeleteBatch)

			//分页及条件查询
			authRouter.POST("/role/page", admin.SysRolePage)

			//获取用户已分配角色的数据
			authRouter.GET("/role/assigned/:id", admin.SysRoleAssigned)

			//给用户分配角色
			authRouter.POST("/role/assign", admin.SysRoleAssign)

		}
	}
}
